<?php
    header('Cache-control: private'); // IE 6 FIX

    if(isSet($_POST['lang']))
    {
        $lng = $_POST['lang'];
        // register the session and set the cookie
        $_SESSION['lang'] = $lng;
        setcookie('lang', $lng, time() + (3600 * 24 * 30));
    }
    else if(isSet($_SESSION['lang']))
    {
        $lng = $_SESSION['lang'];
    }
    else if(isSet($_COOKIE['lang']))
    {
        $lng = $_COOKIE['lang'];
    }
    else
    {
        $lng = 'en';
    }
    if(!isSet($_COOKIE['lang']))
            setcookie('lang', $lng, time() + (3600 * 24 * 30));
         
    $lang_file = 'lang.'.$lng.'.php';   

?>
